<%@ page language="java"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <title>大屏展示</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!-- 引用新样式 start -->
    <jsp:include page="../../jsp/public.jsp" flush="true"/>
    <style>
        span {
            font-size: 19px
        }

        i {
            width: 33px;
            height: 30px
        }

        th {
            text-align: center;
        }
    </style>
    <script>
        function queryModelList(page, pageSize) {
            //var data = "page="+page+"&pageSize="+pageSize;
            var data = $("#queryForm").serialize();
            window.location.href = "<%=path%>/bus/screen/showScreen?" + data;
        }

        function hiddaping() {
            $("#daping").hide();
            $("#hiddap").hide();
            $("#showdap").show();
        }

        function showdaping() {
            $("#daping").show();
            $("#hiddap").show();
            $("#showdap").hide();
        }

        function setIframeHeight(iframe) {
            if (iframe) {
                var iframeWin = iframe.contentWindow;
                if (iframeWin.document.body) {
                    iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
                }
            }
        }

        var page = 0;
        var pageSize = 9;
        $(function () {
            function show() {
                page = Number(page) + 1;
                queryModelList(page, pageSize);
            }

            page = $("#page").val();
            //setInterval(show,5000);
        });
    </script>
<body style="overflow:hidden" class="font">
<div class="col-lg-10 index-nav-right-con" style="width: 100%">
    <form id="queryForm" method="post">
        <div class="search-form" id="daping">
            <div class="search-form-input">
                <label>部品番号</label><input type="text" name="modelCode" id="modelCode"
                                          value="${map['modelCode'] }"/>
            </div>
            <div class="search-form-input">
                <label>厂家</label>
                <select name="orgCode" id="orgCode">
                    <option value="">请选择</option>
                    <c:if test="${not empty factoryList}">
                        <c:forEach items="${factoryList }" var="factoryList"
                                   varStatus="m">
                            <option value="${factoryList.orgCode}"
                                    <c:if test="${factoryList.orgCode==map['orgCode']}">selected</c:if>
                            >${factoryList.orgName}</option>
                        </c:forEach>
                    </c:if>
                </select>
            </div>
            <div class="search-form-input">
                <label>机种:</label>
                <select name="modelType" id="modelType">
                    <option value="">请选择</option>
                    <c:if test="${not empty mTypeList}">
                        <c:forEach items="${mTypeList }" var="mTypeList"
                                   varStatus="m">
                            <option value="${mTypeList.targetName}"
                                    <c:if test="${map['modelType'] ==mTypeList.targetName }">selected</c:if>>${mTypeList.targetName}</option>
                        </c:forEach>
                    </c:if>
                </select>
            </div>
            <div class="search-form-btn search-form-input" style="margin-right: 40px;border: 0px solid red;">
                <button class="btn btn-primary search-form-btn-s" style="color:rgba(29,25,18,0.82);"
                        onclick="queryModelList()">搜索
                </button>
            </div>
        </div>
        <button type="button" class="btn btn-link" onclick="hiddaping()" id="hiddap">隐藏搜索栏</button>
        <button type="button" class="btn btn-link" onclick="showdaping()" id="showdap" style="display: none">显示搜索栏
        </button>
        <table style="width: 100%" action="<%=path%>/bus/screen/showScreen">
            <tr>
                <td>
                    <table class="table table-striped" class="font" style="width:100%;text-align:center;">
                        <thead>
                        <tr class="table-thead">
                            <th style="width:80px;">PRG</th>
                            <th style="width:90px;">已完成工序</th>
                            <c:if test="${not empty list}">
                                <c:forEach items="${cloumns }" var="column" varStatus="r">
                                    <th style="height:18px;width:75px;<c:if test="${column.date == newDate }">
                                            background-color: yellow;
                                            </c:if>">
                            <span <c:if test="${column.date == newDate }">
                                style="color: red;"
                            </c:if>
                             <c:if test="${column.date != newDate }">
                                 style="color: gray;"
                             </c:if>
                            >${column.date }
                                <%--(周${column.isWeekend })--%>
                            </span>
                                    </th>
                                </c:forEach>
                            </c:if>
                            <!-- <th style="width: 80px">总天数</th> -->
                        </tr>

                        </thead>
                        <c:if test="${not empty list}">
                        <tbody>
                        <c:forEach items="${list }" var="model" varStatus="r">
                        <tr class="progress-date-table-tr">
                            <td style="height:68px"><span class="font">${model.modelCode }</span><span
                                    class="font">${model.factory }</span><span class="font">${model.engineering }&nbsp;&nbsp; ${model.modelLevel }</span>
                            </td>
                            <c:if test="${not empty model.cp}">

                                <td style="height:68px">
                                    <c:forEach items="${model.cp }" var="items" varStatus="r1">
                                        <span class="font" style="<c:if
                                                test="${items.processName == '出货准备' }">font-size: 18px;</c:if>">${items.processName }</span>
                                        <c:if test="${items.status=='0' }">
                                            <i class="progress-circle-black"
                                               style="cursor: pointer;width:39px;height:36px;"><span
                                                    class="font">
                                                <c:if test="${items.day>=0 }">
                                                    ${items.day }
                                                </c:if>
                                                <c:if test="${items.day<0 }">
                                                    ${items.day*-1 }
                                                </c:if>
                                            </span></i>
                                        </c:if>
                                        <c:if test="${items.status=='1' }">
                                            <i class="progress-circle-purple"
                                               style="cursor: pointer;width:39px;height:36px;"><span
                                                    class="font">
                                                <c:if test="${items.day>=0 }">
                                                    ${items.day }
                                                </c:if>
                                                <c:if test="${items.day<0 }">
                                                    ${items.day*-1 }
                                                </c:if>
                                            </span></i>
                                        </c:if>
                                        <c:if test="${items.status=='2' }">
                                            <i class="progress-circle-pink"
                                               style="cursor: pointer;width:39px;height:36px;"><span
                                                    class="font">
                                        <c:if test="${items.day>=0 }">
                                            ${items.day }
                                        </c:if>
                                                <c:if test="${items.day<0 }">
                                                    ${items.day*-1 }
                                                </c:if>
                                            </span></i>
                                        </c:if>
                                    </c:forEach>
                                </td>
                            </c:if>
                            <c:if test="${empty model.cp}">
                                <td></td>
                            </c:if>
                            <c:forEach items="${model.items }" var="item" varStatus="r1">
                                <td style="height:68px;
                                <c:if test="${item.date == newDate }">
                                        background-color: yellow;
                                        </c:if>">
                               <span class="font"
                                     style="
                                     <c:if test="${item.date == newDate }">color: red;</c:if>
                                     <c:if test="${item.progress == '出货准备' }">font-size: 18px;</c:if>"
                               >
                                   <c:if test="${item.progress==null && item.stamp=='isDelay'}">
                                       出货 (100%)
                                   </c:if>
                                   <c:if test="${item.progress!=null}">
                                       <c:if test="${ item.progress !=null }">${item.progress }
                                           <c:if test="${ item.planPro !=null }">(${item.planPro }%)</c:if>
                                           <c:if test="${ item.planPro ==null }">(0%)</c:if>
                                       </c:if>
                                   </c:if>
                               </span>

                                        <%--当厂家 从来未提交过任务时,为0 不显示实际比例等--%>

                                        <%--周一周三周五，厂家未提交进度的话，大屏上只显示计划比例跟进度，不沿用头一天--%>
                                        <%--为今天时判断--%>

                                        <c:if test="${item.date == newDate }">
                                            <c:if test="${(item.isWeekend==2 ||item.isWeekend==5) && item.lastTime=='0' }">
                                                <c:if test="${item.recordStatus!='notShow' }">
                                                    <c:if test="${item.recordStatus=='正常' }">
                                                        <i class="<c:if test="${item.date == newDate }">progress-circle-black </c:if><c:if test="${item.date != newDate }">progress-circle-gray </c:if>"
                                                           style="cursor: pointer;width:39px;height:36px;"><span
                                                                class="font"><c:if
                                                                test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                    </c:if>
                                                    <c:if test="${item.recordStatus=='提前' }">
                                                        <i class="progress-circle-purple"
                                                           style="cursor: pointer;width:39px;height:36px;"><span
                                                                class="font"><c:if
                                                                test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                    </c:if>
                                                    <c:if test="${item.recordStatus=='延期' }">
                                                        <i class="progress-circle-pink"
                                                           style="cursor: pointer;width:39px;height:36px;"><span
                                                                class="font"><c:if
                                                                test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                    </c:if> <br>

                                                    <c:if test="${item.recordStatus=='正常' || item.recordStatus=='提前' || item.recordStatus=='延期' }">
                                                        <%--如果是当天,没有审核,不显示--%>
                                                        <c:if test="${item.date == newDate}">
                                                            <c:if test="${ item.currentPro !=null }">${item.currentPro }
                                                                <c:if test="${ item.accPro !=null }">(${item.accPro }%)</c:if>
                                                                <c:if test="${ item.accPro ==null }">(0%)</c:if>
                                                                <%-- <c:if test="${ item.accPre !=null }">(${item.accPre }%)</c:if> --%>
                                                            </c:if>
                                                        </c:if>
                                                        <c:if test="${item.date != newDate}">
                                                            <c:if test="${ item.currentPro !=null }">${item.currentPro }
                                                                <c:if test="${ item.accPro !=null }">(${item.accPro }%)</c:if>
                                                                <c:if test="${ item.accPro ==null }">(0%)</c:if>
                                                                <%-- <c:if test="${ item.accPre !=null }">(${item.accPre }%)</c:if> --%>
                                                            </c:if>
                                                        </c:if>
                                                    </c:if>
                                                </c:if>
                                            </c:if>

                                            <%--周二周四周六周日沿用头一天厂家提交的进度--%>
                                            <c:if test="${item.isWeekend==1 || item.isWeekend==3 || item.isWeekend==4 ||item.isWeekend==6 ||item.isWeekend==0 }">
                                                <c:if test="${item.recordStatus!='notShow' }">
                                                    <c:if test="${item.recordStatus=='正常' }">
                                                        <i class="<c:if test="${item.date == newDate }">progress-circle-black </c:if><c:if test="${item.date != newDate }">progress-circle-gray </c:if>"
                                                           style="cursor: pointer;width:39px;height:36px;"><span
                                                                class="font"><c:if
                                                                test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                    </c:if>
                                                    <c:if test="${item.recordStatus=='提前' }">
                                                        <i class="progress-circle-purple"
                                                           style="cursor: pointer;width:39px;height:36px;"><span
                                                                class="font"><c:if
                                                                test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                    </c:if>
                                                    <c:if test="${item.recordStatus=='延期' }">
                                                        <i class="progress-circle-pink"
                                                           style="cursor: pointer;width:39px;height:36px;"><span
                                                                class="font"><c:if
                                                                test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                    </c:if> <br><br>
                                                    <c:if test="${item.recordStatus=='正常' || item.recordStatus=='提前' || item.recordStatus=='延期' }">
                                                        <%--如果是当天,没有审核,不显示--%>
                                                      	<c:if test="${item.date == newDate}">
                                                            <c:if test="${ item.currentPro !=null }">${item.currentPro }
                                                                <c:if test="${ item.accPro !=null }">(${item.accPro }%)</c:if>
                                                                <c:if test="${ item.accPro ==null }">(0%)</c:if>
                                                                <%-- <c:if test="${ item.accPre !=null }">(${item.accPre }%)</c:if> --%>
                                                            </c:if>
                                                        </c:if>
                                                        <c:if test="${item.date != newDate}">
                                                            <c:if test="${ item.currentPro !=null }">${item.currentPro }
                                                                <c:if test="${ item.accPro !=null }">(${item.accPro }%)</c:if>
                                                                <c:if test="${ item.accPro ==null }">(0%)</c:if>
                                                                <%-- <c:if test="${ item.accPre !=null }">(${item.accPre }%)</c:if> --%>
                                                            </c:if>
                                                        </c:if>
                                                    </c:if>
                                                </c:if>
                                            </c:if>
                                        </c:if>
                                        <%--不等于今天--%>
                                        <c:if test="${item.date != newDate }">
                                            <c:if test="${item.recordStatus!='notShow' }">
                                                <c:if test="${item.recordStatus=='正常' }">
                                                    <i class="<c:if test="${item.date == newDate }">progress-circle-black </c:if><c:if test="${item.date != newDate }">progress-circle-gray </c:if>"
                                                       style="cursor: pointer;width:39px;height:36px;"><span
                                                            class="font"><c:if
                                                            test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                </c:if>
                                                <c:if test="${item.recordStatus=='提前' }">
                                                    <i class="progress-circle-purple"
                                                       style="cursor: pointer;width:39px;height:36px;"><span
                                                            class="font"><c:if
                                                            test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                </c:if>
                                                <c:if test="${item.recordStatus=='延期' }">
                                                    <i class="progress-circle-pink"
                                                       style="cursor: pointer;width:39px;height:36px;"><span
                                                            class="font"><c:if
                                                            test="${r1.index<7 }">${item.days }</c:if></span></i><span><c:if test="${ item.accPre !=null }"><font size="3px">精度：${item.accPre }%</font></c:if></span>
                                                </c:if> <br><br>
                                                <c:if test="${item.recordStatus=='正常' || item.recordStatus=='提前' || item.recordStatus=='延期' }">
                                                    <%--如果是当天,没有审核,不显示--%>
                                                    <c:if test="${item.date == newDate}">
                                                        <c:if test="${ item.currentPro !=null }">${item.currentPro }
                                                            <c:if test="${ item.accPro !=null }">(${item.accPro }%)</c:if>
                                                            <c:if test="${ item.accPro ==null }">(0%)</c:if>
                                                            <%-- <c:if test="${ item.accPre !=null }">(${item.accPre }%)</c:if> --%>
                                                        </c:if>
                                                    </c:if>
                                                    <c:if test="${item.date != newDate}">
                                                        <c:if test="${ item.currentPro !=null }">${item.currentPro }
                                                            <c:if test="${ item.accPro !=null }">(${item.accPro }%)</c:if>
                                                            <c:if test="${ item.accPro ==null }">(0%)</c:if>
                                                            <%-- <c:if test="${ item.accPre !=null }">(${item.accPre }%)</c:if> --%>
                                                        </c:if>
                                                    </c:if>
                                                </c:if>
                                            </c:if>
                                        </c:if>
                                </td>
                            </c:forEach>
                                <%--  <td><span class="font">实际天数</span><span class="fount">${model.actualDays }</span></td> --%>

                        </tr>
                        </c:forEach>
                        </c:if>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="background: #f8f8f8">
                    <span>
                        <jsp:include page="/WEB-INF/jsp/page.jsp"></jsp:include>
                    </span>
                    </div>
                </td>
            </tr>
        </table>
    </form>
</div>
<%-- <input type = "text" hidden = "true"  value = "${page}" id = "page"/> --%>
</body>
</html>